home *** CD-ROM | disk | FTP | other *** search
- {$S5} { set stack space to 5k... }
- PROGRAM Newedit;
- {**************************************************************************
- PROGRAM COPYRIGHT 1986 OSS. ALL COMMERCIAL RIGHTS RESERVED.This program is
- in the public domain. You may give away copies of this program and/or
- source code to anyone willing to take it! Program sets up mouse in cursor
- key mode then chains original editor, passing original command-line args to
- program. On exit, restore mouse to mouse mode. Written 10-28-86 M. Curry.
- <Modified to permit compilation with V.1.02 OSS/PASCAL 20Apr'87 CJPurcell>
- To use this program:
- O. Rename NEW_EDIT.CJP to NEW_EDIT.PAS
- 1. Compile this program using "Compile and link for TOS" options,
- thus forming <new_edit.tos> .
- < I had to fix some parameters as noted and replace an omitted brace. CJP>
- <I had to link with paslib,explicitly and then PASLIB,automatically. Why? CJP>
- 2. Rename EDITOR.PRG to EDIT.TTP <edit.ttp>
- 3. Rename new_edit.tos to EDITOR.PRG. <editor.prg>
- 4. Edit any source text and move the mouse as appropriate.
- Use within OSS/PASCAL environment.The cursor should follow the mouse movements.
- 5. Copy editor.prg to MOUSEDIT.TTP for TosTakeParameter usage.
- Usage: MOUSEDIT.TTP <filename> [<line> [<column> [<errnum> ]]]mouse is mouse...
- For use as a general purpose editor for 'what you see is what you get' editing.
- ***************************************************************************}
- CONST
- IKBD = 4; { device number of Keyboard processor }
- LoadAndGo = 0;
- TYPE
- Cstring = PACKED ARRAY [ 1..80 ] OF CHAR;
- VAR
- RetCode : Integer; { returned value from editor }
- FUNCTION Bcostat( Dev : Integer ) : Boolean; Bios( 8 );
- PROCEDURE Bconout( Dev : Integer; C : Char ); Bios( 3 );
- PROCEDURE Pterm( Retval : Integer ); Gemdos( $4c );
- FUNCTION Pexec( Mode : Integer;
- VAR Prog : Cstring;
- VAR Tail : STRING;
- Env : Long_Integer ) : Integer;
- Gemdos( $4b );
- PROCEDURE Make_Cstr( ps : STRING; VAR cs : Cstring);
- { convert pascal string ps to C string cs }
- VAR i : Integer;
- BEGIN
- cs[ 1 ] := Chr( 0 ); { set to null for safety }
- FOR i := 1 to Length( ps ) DO
- cs[ i ] := ps[ i ];
- cs[ Length( ps )+1 ] := Chr( 0 );
- END;
- PROCEDURE KOUT( C : Integer ); { changed to Integer }
- BEGIN
- WHILE NOT Bcostat( IKBD ) DO; { wait till kbd is ready }
- Bconout( IKBD, Chr(C) ); { send bound char to kbd }
- END;
- PROCEDURE SetCurs;
- BEGIN
- KOUT( $0A ); { set mouse cursor mode hex }
- KOUT( $05 ); { 5 pulses / x movement hex }
- KOUT( $0A ); { 10 pulses / y movement hex }
- END;
- PROCEDURE SetMous;
- BEGIN
- KOUT( $08 ); { set mouse mouse mode hex }
- END;
- FUNCTION RunProg : INTEGER;
- VAR
- I : Integer;
- Temp,
- CmdLine,
- Args : STRING;
- C_CmdLine : Cstring;
- BEGIN
- CmdLine := 'EDIT.TTP'; { new name of original editor program for use }
- Args := '';
- FOR I := 1 to Cmd_Args DO
- BEGIN
- Cmd_GetArg( I, Temp );
- Args := Concat( Args, ' ', Temp )
- END;
- Make_Cstr( CmdLine, C_CmdLine );
- Args := Concat( Args, ' ' );
- Args[ Length( Args ) ] := Chr( 0 );
- Writeln( Args );
- RunProg := Pexec( LoadAndGo, C_Cmdline, Args, 0 );
- END;
- BEGIN { introduce ourselves... }
- Writeln( 'MCursor V1.1 From OSS/PASCAL' );
- Writeln( 'Public Domain -- Free to all!' );
- Writeln( 'Help Key and Mouse Cursor Active...' );
- SetCurs; { set mouse cursor-mode. }
- RetCode := RunProg; { run program, copying command line args to it }
- SetMous; { set mouse mouse-mode }
- Writeln( 'Mouse is Mouse...' );
- Pterm( RetCode ); { return value to manager }
- END.
-